package com.tcl.zenglx.file;

import com.tcl.zenglx.file.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author liangxi.zeng
 */
@SpringBootApplication
public class BigFileUploadApplication implements ApplicationRunner {

    @Autowired
    private StorageService storageService;

    public static void main(String[] args) {
        SpringApplication.run(BigFileUploadApplication.class, args);
    }

    /**
     * Callback used to run the bean.
     *
     * @param args incoming application arguments
     * @throws Exception on error
     */
    @Override
    public void run(ApplicationArguments args) {
        storageService.deleteAll();
        storageService.init();
    }
}
